package com.utils.httphelper;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class DecodeUrl {
	public static String decodeUrl(String url) {
		String keyWord = "";
		try {   
            keyWord = URLDecoder.decode(url, "GBK");    
//            String urlString = URLEncoder.encode("你好", "GBK");  //输出%C4%E3%BA%C3  
        } catch (UnsupportedEncodingException e) {  
            e.printStackTrace();  
        } 
		return keyWord;
	}
	

    public static final String decodeURL(String param){
        if(param == null) return null;
        try{
            return URLDecoder.decode(param,"UTF-8");
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    public static final String encodeURL(String param){
        if(param == null) return null;
        try{
            return URLEncoder.encode(param,"UTF-8");
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
